import http from '@/api';

// 用户修改密码
export const userUpPasswordByUser = params => {
  return http.post(`/user/upPasswordUser`, params);
};

// 角色列表
export const roleList = params => http.post(`/role/page`, params);

// 角色新增
export const roleSave = params => http.post(`/role/save`, params);

// 角色新增
export const roleUpdate = params => http.post(`/role/update`, params);

// 角色删除
export const roleRemove = params => http.get(`/role/delete/${params.id}`);

// 为角色添加用户
export const userRoleAdd = params => http.post(`/userRole/add`, params);

// 分页查询角色下用户列表
export const userRolePageUserByRole = params => http.post(`/user/pageUserByRole/${params.roleId}`, params);

export const userRolePageUserByNoRole = params => http.post(`/user/pageUserByNoRole/${params.roleId}`, params);

// 查询角色下的权限列表
export const userRoleListByRole = params => http.post(`/userRole/listByRole`, params);

// 为角色添加权限
export const rolePermissionAdd = params => http.post(`/rolePermission/add`, params);
// 查询角色下的权限列表
export const rolePermissionListByRole = params => http.post(`/rolePermission/listByRole`, params);

// 角色下删除用户
export const userRoleDelete = params => http.post(`/userRole/delete`, params);

// 为角色添加用户(追加)
export const userRoleAddByAppend = params => http.post(`/userRole/addByAppend`, params);

// 根据角色id查询绑定的权限
export const permissionFindByRoleId = params => http.get(`/permission/findByRoleId`, params);
export const permissionFindByNoRoleId = params => http.get(`/permission/findByNoRoleId`, params);

export const permissionListTree = params => http.post(`/permission/listTree`, params);

export const roleDelPremByRoleId = params => http.post(`/role/delPremByRoleId`, params);
export const roleSavePremByRoleId = params => http.post(`/role/savePremByRoleId`, params);
